From 8e47b1c909e2e0efb10e99e8decb99784339aed6 Mon Sep 17 00:00:00 2001 From: "sos22@labyrinth.cl.cam.ac.uk" Date: Tue, 8 Jul 2003 09:06:03 +0000 Subject: [PATCH] bitkeeper revision 1.289.2.2 (3f0a897bGzUUM0kzMiUA41zn4irydw) Find domains using find_domain_by_id rather than by looping over the task list. --- xen/drivers/block/xen_physdisk.c | 21 ++++++++++----------- xen/drivers/block/xen_segment.c | 10 +++------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/xen/drivers/block/xen_physdisk.c b/xen/drivers/block/xen_physdisk.c index e0d697bd66..c5d2deb82a 100644 --- a/xen/drivers/block/xen_physdisk.c +++ b/xen/drivers/block/xen_physdisk.c @@ -188,10 +188,8 @@ int xen_physdisk_grant(xp_disk_t *xpd_in) DPRINTK("Have current.\n"); DPRINTK("Target domain %x\n", xpd->domain); - do { - p = p->next_task; - } while (p != current && p->domain != xpd->domain); - if (p->domain != xpd->domain) { + p = find_domain_by_id(xpd->domain); + if (p == NULL) { DPRINTK("Bad domain!\n"); res = 1; goto out; @@ -203,6 +201,7 @@ int xen_physdisk_grant(xp_disk_t *xpd_in) xpd->mode, p); spin_unlock(&p->physdev_lock); + put_task_struct(p); out: unmap_domain_mem(xpd); @@ -216,16 +215,14 @@ int xen_physdisk_probe(struct task_struct *requesting_domain, physdisk_probebuf_t *buf = map_domain_mem(virt_to_phys(buf_in)); int res; - p = current; - do { - p = p->next_task; - } while (p != current && p->domain != buf->domain); - if (p->domain != buf->domain) { + if (requesting_domain->domain != 0 && + requesting_domain->domain != buf->domain) { res = 1; goto out; } - if (requesting_domain->domain != 0 && - requesting_domain->domain != buf->domain) { + + p = find_domain_by_id(buf->domain); + if (p == NULL) { res = 1; goto out; } @@ -233,6 +230,8 @@ int xen_physdisk_probe(struct task_struct *requesting_domain, spin_lock(&p->physdev_lock); xen_physdisk_probe_access(buf, p); spin_unlock(&p->physdev_lock); + put_task_struct(p); + res = 0; out: unmap_domain_mem(buf); diff --git a/xen/drivers/block/xen_segment.c b/xen/drivers/block/xen_segment.c index 6691eecb0e..2f110423f0 100644 --- a/xen/drivers/block/xen_segment.c +++ b/xen/drivers/block/xen_segment.c @@ -250,15 +250,11 @@ int xen_segment_create(xv_disk_t *xvd_in) } /* if the domain exists, assign the segment to the domain */ - p = current; - do - { - p = p->next_task; - } while (p != current && p->domain != xvd->domain); - - if (p->domain == xvd->domain) + p = find_domain_by_id(xvd->domain); + if (p != NULL) { p->segment_list[xvd->segment] = &xsegments[idx]; + put_task_struct(p); } unmap_domain_mem(xvd); -- 2.30.2